<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../share/taglib.jsp" %>
<%@ include file="../share/isReadOnly.inc" %>
<html>
<head>
<title><bean:message key="info.area.${isTop ? '1' : '2'}"/><bean:message key="display.manage"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/vip.css" type="text/css">
<script language="JavaScript">
//到指定的分页页面
function topage(page){
	var form = document.forms[0];
	form.page.value=page;
	form.submit();
}

function deleteArea(url, needConfirm) {
	if (needConfirm) {
		if(!confirm('此操作将会一并删除该一级区域下的所有子区域，你确定要删除此一级区域吗？')) {
			return false;
		}
	}
	window.location.href = url;
}
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" marginwidth="0" marginheight="0">
<html:form action="/cms/house/area.do" method="post">
<html:hidden property="page"/>
<html:hidden property="name"/>
<html:hidden property="isTop"/>
<html:hidden property="query"/>
<html:hidden property="parentAreaId"/>
<html:hidden property="method" value="list"/>
  <table width="98%" border="0" cellspacing="1" cellpadding="2" align="center">
    <tr ><td colspan="${isTop ? '6' : '6'}"  bgcolor="#ffbe26" align="right">
    	<%@ include file="../share/fenye.jsp" %>
   </td></tr>
    <tr>
      <td width="10%" bgcolor="#ffbe26"> <div align="center"><font color="#000000"><bean:message key="display.number"/></font></div></td>
      <td width="40%" bgcolor="#ffbe26"> <div align="center"><font color="#000000"><bean:message key="info.area.${isTop ? '1' : '2'}"/></font></div></td>
      <td width="20%" bgcolor="#ffbe26" style="display: ${isTop ? 'none' : ''};"> <div align="center"><font color="#000000"><bean:message key="info.area.1"/></font></div></td>
      <td width="20%" bgcolor="#ffbe26" style="display: ${isTop ? '' : 'none'};"> <div align="center"><font color="#000000"><bean:message key="info.area.2"/></font></div></td>
      <td width="20%" bgcolor="#ffbe26"> <div align="center"><font color="#000000">是否可见</font></div></td>
      <td width="5%" nowrap bgcolor="#ffbe26"> <div align="center"><font color="#000000"><bean:message key="display.edit"/></font></div></td>
      <td width="5%" nowrap bgcolor="#ffbe26"> <div align="center"><font color="#000000"><bean:message key="display.delete"/></font></div></td>
    </tr>
<!---------------------------LOOP START------------------------------>
<c:forEach items="${pageView.records}" var="entry">
    <tr>
      <td bgcolor="f5f5f5"><div align="center">${entry.areaId}</div></td>
      <td bgcolor="f5f5f5"><div align="center">${entry.name}</div></td>
      <td bgcolor="f5f5f5" style="display: ${isTop ? 'none' : ''};"><div align="center">${entry.parentArea.name}</div></td>
      <td bgcolor="f5f5f5" style="display: ${isTop ? '' : 'none'};">
      	<div align="center"><a href="<html:rewrite action="/cms/house/area"/>?method=list&parentAreaId=${entry.areaId}&isTop=false" title="点击查看<bean:message key="info.area.2"/>">${fn:length(entry.areas)}个<bean:message key="info.area.2"/></a></div>
      </td>
      <td bgcolor="f5f5f5"><div align="center">${entry.visible ? '是' : '否'}</div></td>
      <td bgcolor="f5f5f5"><div align="center">
      	<a href="<html:rewrite action="/cms/house/area"/>?method=editUI&areaId=${entry.areaId}&isTop=${isTop}">
	  	<img src="/images/edit.gif" width="15" height="16" border="0"/></a>
	  	</div>
	  </td>
	  <td bgcolor="f5f5f5"><div align="center">
	  <% if (isReadOnly) { %>
	  	<img src="/images/delete.gif" style="cursor:hand;" width="15" height="16" border="0" />
	  <% } else { %>
	  	<img src="/images/delete.gif" style="cursor:hand;" width="15" height="16" border="0" onClick="javascript:deleteArea('/cms/house/area.do?method=delete&areaId=${entry.areaId}&isTop=${isTop}', ${isTop ? 'true' : 'false'});">
	  <% } %>
	  </div>
	  </td>
	</tr>
</c:forEach>
    <!----------------------LOOP END------------------------------->
    <tr> 
      <td bgcolor="f5f5f5" colspan="6" align="center"><table width="100%" border="0" cellspacing="1" cellpadding="3">
          <tr> 
            <td width="5%"></td>
              <td width="85%">
              <input name="AddDic" type="button" <%=isReadOnly ? "disabled='disabled'" : ""%> class="frm_btn" id="AddDic" onClick="javascript:window.location.href='<html:rewrite action="/cms/house/area"/>?method=addUI&isTop=${isTop}'" value="<bean:message key="display.add"/><bean:message key="info.area.${isTop ? '1' : '2'}"/>">&nbsp;&nbsp;
			  <input name="query" type="button" class="frm_btn" id="query" onClick="javascript:window.location.href='<html:rewrite action="/cms/house/area"/>?method=queryUI&isTop=${isTop}'" value="<bean:message key="display.query"/> ">&nbsp;&nbsp;
            </td>
          </tr>
        </table></td>
    </tr>
  </table>
</html:form>
</body>
</html>